home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / sealink.arc / SEALINK.DOC < prev   
Text File  |  1985-11-20  |  12KB  |  271 lines

  1.                                      SEALINK
  2.  
  3.                              File Transfer Protocol
  4.  
  5.                                  9 February 1987
  6.  
  7.  
  8.  
  9.           (C) COPYRIGHT 1986,87 by System Enhancement Associates, Inc.
  10.  
  11.  
  12.  
  13.      This document describes briefly the  SEAlink  file  transfer  protocol
  14.      developers' package.  SEAlink is a sliding  window  protocol  that  is
  15.      fully  backwards compatible with XMODEM in all tested implementations.
  16.  
  17.      The intent of SEAlink is to provide a file transfer protocol that does
  18.      not  suffer  from  propagation  delays,  such  as  are  introduced  by
  19.      satellite relays or packet switched  networks.  Actual  tests  of  the
  20.      enclosed  routines  has  shown  that  SEAlink  is capable of virtually
  21.      eliminating propagation delays and turnaround delays.  File  transfers
  22.      between New Jersey and Hawaii,  which normally suffer a degradation of
  23.      50% or more  due  to  satellite  relays,  proceed  as  fast  as  local
  24.      transfers.  Even transfers within the local exchange are speeded up by
  25.      up to 20% at 2400 baud by the elimination of turnaround delays.  Large
  26.      volume  tests  show  that SEAlink is capable of coming to within 2% of
  27.      the theoretical minimum time for data transfer.
  28.  
  29.  
  30.  
  31.      The developers' package contains the following files:
  32.  
  33.          SEALINK.DOC    This document.
  34.          SEALINK.C      A set of C routines for implementing SEAlink.
  35.          CLINK.EXE      A sample TTY program that implements SEAlink.
  36.  
  37.  
  38.  
  39.      You are granted a license to use this code in your  programs,  and  to
  40.      adapt  it to your particular situation and needs,  subject only to the
  41.      following conditions:
  42.  
  43.      1) You must refer to it as the SEAlink protocol,  and  you  must  give
  44.         credit to System Enhancement Associates.
  45.  
  46.      2) If  you  modify  it in such a way that your version cannot converse
  47.         with the original code as supplied by us,  then you should refer to
  48.         it as "SEAlink derived",  or as a "variation of SEAlink",  or words
  49.         to that effect.
  50.  
  51.      In short,  we're not asking for any money,  but we'd like to get  some
  52.      credit for our work.
  53.  
  54.  
  55.      This  document  is  not  meant  to  be  a  rigorous  definition of the
  56.      protocol.  The code provided should serve to document the details  and
  57.      fine  points  of  implementing SEAlink.  We will,  however,  present a
  58.      brief synopsis of how SEAlink adds sliding windows to XMODEM,  and why
  59.      XMODEM doesn't mind.
  60.  
  61.      First of all,  SEAlink adds a block number to the ACK and NAK used  in
  62.      XMODEM.(1)  We  thus  create  "ACK/NAK  packets",  with  the following
  63.      structure:
  64.  
  65.          Byte 0:   ACK, NAK, or C
  66.          Byte 1:   Block number
  67.          Byte 2:   One's compliment of block number
  68.  
  69.      This is identical in form to the first three bytes of a  data  packet,
  70.      except that the SOH has been replaced with an ACK or NAK.(2)
  71.  
  72.      From the receiver's point of view,  it does not matter if  the  trans-
  73.      mitter  is using sliding window or not.  The receiver simply sends ACK
  74.      and NAK packets as appropriate.  Any XMODEM driver tested to date will
  75.      simply ignore this excess data behind the ACK or NAK.
  76.  
  77.      From the transmitter's point of view,  it just barely matters  if  the
  78.      receiver can handle sliding window.  The transmitter always acts as if
  79.      it  is  sending sliding window,  but varies the window size.  If it is
  80.      seeing valid block numbers and check values behind the  received  ACKs
  81.      and NAKs,  it sets the window size to six blocks.  Otherwise,  it sets
  82.      the  window  size  to  one  block.  The  result is that it only "sends
  83.      ahead" if the receiver can handle it.
  84.  
  85.      It  should  be  a fairly simple matter to apply the underlying SEAlink
  86.      logic to almost any variant of XMODEM.
  87.  
  88.  
  89.      The  SEAlink  routines  provided  in  this package are also capable of
  90.      passing system dependent information,  such as true file size and time
  91.      of  last modification.  This data is passed in a special header block.
  92.      The header block looks exactly like any other block, except that it is
  93.      block number zero.
  94.  
  95.      This is still backwards compatible with XMODEM,  as a SEAlink receiver
  96.      does  not  mind if block zero is missing,  and any XMODEM receiver yet
  97.      tested will regard block zero as a duplicate block and ACK it.
  98.  
  99.      The data portion of block zero contains the following fields:
  100.  
  101.  
  102.          Offset    Size      Contents
  103.          ======    ====      ========
  104.  
  105.             0        4       Original file length.
  106.             4        4       Date  and  time  file  was  last mofified,  in
  107.                              seconds since 1979.
  108.             8       17       Original  file  name,  as  a  null  terminated
  109.                              string.
  110.            25       15       Name  of  transmitting  program,   as  a  null
  111.                              terminated string.
  112.            40       88       Null filler and expansion area.
  113.  
  114.  
  115.      (1) XMODEM/CRC uses a "C" in place of  a  NAK  to  indicate  CRC  error
  116.          detection.  SEAlink  follows  this convention,  and supports either
  117.          checksum or CRC.  For brevity,  this document will use the term NAK
  118.          to mean either a true NAK (hex 15) or a C (hex 43).
  119.      (2) See previous footnote.
  120.  
  121.      Any field which the transmitter cannot support should be  set  to  all
  122.      zeros.  Conversly,  the  receiver  should ignore any null fields.  The
  123.      receiver may ignore any field which he cannot support.
  124.  
  125.  
  126.  
  127.      The  routines  enclosed  in  this package should be reasonably easy to
  128.      implement in your application.  We have attempted to exclude  compiler
  129.      dependent and system dependent logic from these routines.
  130.  
  131.  
  132.      You will need to alter our references to our communications driver  to
  133.      conform  to  your  own driver.  The communications related routines we
  134.      use are:
  135.  
  136.          com_putc(c)         Output character c to comm port.
  137.  
  138.          int com_getc(t)     Get character from comm port within  t  tenths
  139.                              of   a  second.   Return  EOF  if  time  limit
  140.                              expires.
  141.  
  142.          com_dump()          Discard any pending output without sending it.
  143.  
  144.  
  145.      In  addition,  we  use  the  following  routines for controlling timed
  146.      loops:
  147.  
  148.          long timerset(t)    Set a timer.  Returns a timer value which will
  149.                              expire in t tenths of a second.
  150.  
  151.          int timeup(z)       Check a timer.  Returns true if  timer  z  has
  152.                              expired yet, or false otherwise.
  153.  
  154.  
  155.      These routines also make reference to the following functions for
  156.      system dependent information, which is optional:
  157.  
  158.          filestat(name,&fs)  Read directory entry for  a  file  and  return
  159.                              system dependent information.
  160.  
  161.          setstamp(f,dtg)     Set a file's date/time of last modification.
  162.  
  163.  
  164.  
  165.  
  166.      The SEAlink  implementation  provided  in  this  package  is  used  by
  167.      invoking the two primary routines:
  168.  
  169.  
  170.          int xmtfile(name)             /* transmit a file */
  171.          char *name;                   /* name of file to transmit */
  172.  
  173.      This  routine is used to send a file.  One file is sent at a time.  If
  174.      the  name  is blank (name is null or *name points to a null),  then an
  175.      end of transmission marker is sent.
  176.  
  177.      This routine returns a one if the file is successfully transmitted, or
  178.      a zero if a fatal error occurs.
  179.  
  180.  
  181.          char *rcvfile(name)           /* receive a file */
  182.          char *name;                   /* name of file (optional) */
  183.  
  184.      This routine is used to receive a file.  One file is  received.  If  a
  185.      name is specified for the file,  then that name WILL be used,  and any
  186.      name  sent  by  the transmitter will be ignored.  If the name is blank
  187.      (name is null or *name points to a null),  then the  transmitter  must
  188.      provide a name for the